using System;
using System.Collections.Generic;
using System.Data.Linq.Mapping;
using InfoTech.Core.Data.Attributes;
using InfoTech.Core.Data.Dataable;
using InfoTech.Core.Data.Persistence;
using InfoTech.Utilities.Generic;

namespace InfoTech.LanTranh.MucVu.Bussiness
{
	[Serializable]
	[ExtraTable(Name = "GIAOXU", Schema="dbo")]
	[Table(Name = "[dbo].[GIAOXU]")]
	public partial class GIAOXU : ObjPersistence, IDeleteable, IUpdateable, IInsertable, ISelectable, IDeleteablebyId, IUpdateablebyId, ISelectablebyId
	{

		#region Fields

		private System.Guid _magiaoxu;

		private System.Guid? _machaxu;

		private System.Guid? _magiaohat;

		private System.String _tengiaoxu;

		private System.String _diachi;

		private System.String _dienthoai;

		private System.Boolean? _isdata;

		private System.Boolean? _isdefault;

		private IEnumerable<HOGIADINH_DIACHI> _ref_hogiadinh_diachi;

		private IEnumerable<SOHONNHAN> _ref_sohonnhan;

		private IEnumerable<GIAODAN> _ref_giaodan;

		private IEnumerable<GIAODAN_DIACHI> _ref_giaodan_diachi;

		private IEnumerable<GIAOHO> _ref_giaoho;

		private IEnumerable<HOGIADINH> _ref_hogiadinh;

		private LINHMUC _prt_linhmuc;

		private GIAOHAT _prt_giaohat;

		#endregion

		#region Properties

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = false)]
		[Column(Name = "MAGIAOXU", DbType = "uniqueidentifier", IsPrimaryKey = true, CanBeNull = false)]
		public System.Guid MAGIAOXU
		{
			get
			{
				return _magiaoxu;
			}
			set
			{
				OnChanged(this, "MAGIAOXU");
				_magiaoxu = value;
			}
		}

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = true)]
		[Column(Name = "MACHAXU", DbType = "uniqueidentifier", IsPrimaryKey = false, CanBeNull = true)]
		public System.Guid? MACHAXU
		{
			get
			{
				return _machaxu;
			}
			set
			{
				OnChanged(this, "MACHAXU");
				_machaxu = value;
			}
		}

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = true)]
		[Column(Name = "MAGIAOHAT", DbType = "uniqueidentifier", IsPrimaryKey = false, CanBeNull = true)]
		public System.Guid? MAGIAOHAT
		{
			get
			{
				return _magiaohat;
			}
			set
			{
				OnChanged(this, "MAGIAOHAT");
				_magiaohat = value;
			}
		}

		[ExtraColumn(DbType = "nvarchar", Length = 1000, TypeName = "System.String", Type = typeof(System.String), CanBeNull = true)]
		[Column(Name = "TENGIAOXU", DbType = "nvarchar(1000)", IsPrimaryKey = false, CanBeNull = true)]
		public System.String TENGIAOXU
		{
			get
			{
				return _tengiaoxu;
			}
			set
			{
				OnChanged(this, "TENGIAOXU");
				_tengiaoxu = value;
			}
		}

		[ExtraColumn(DbType = "nvarchar", Length = 1000, TypeName = "System.String", Type = typeof(System.String), CanBeNull = true)]
		[Column(Name = "DIACHI", DbType = "nvarchar(1000)", IsPrimaryKey = false, CanBeNull = true)]
		public System.String DIACHI
		{
			get
			{
				return _diachi;
			}
			set
			{
				OnChanged(this, "DIACHI");
				_diachi = value;
			}
		}

		[ExtraColumn(DbType = "nvarchar", Length = 20, TypeName = "System.String", Type = typeof(System.String), CanBeNull = true)]
		[Column(Name = "DIENTHOAI", DbType = "nvarchar(20)", IsPrimaryKey = false, CanBeNull = true)]
		public System.String DIENTHOAI
		{
			get
			{
				return _dienthoai;
			}
			set
			{
				OnChanged(this, "DIENTHOAI");
				_dienthoai = value;
			}
		}

		[ExtraColumn(DbType = "bit", Length = 0, TypeName = "System.Boolean", Type = typeof(System.Boolean), CanBeNull = true)]
		[Column(Name = "ISDATA", DbType = "bit", IsPrimaryKey = false, CanBeNull = true)]
		public System.Boolean? ISDATA
		{
			get
			{
				return _isdata;
			}
			set
			{
				OnChanged(this, "ISDATA");
				_isdata = value;
			}
		}

		[ExtraColumn(DbType = "bit", Length = 0, TypeName = "System.Boolean", Type = typeof(System.Boolean), CanBeNull = true)]
		[Column(Name = "ISDEFAULT", DbType = "bit", IsPrimaryKey = false, CanBeNull = true)]
		public System.Boolean? ISDEFAULT
		{
			get
			{
				return _isdefault;
			}
			set
			{
				OnChanged(this, "ISDEFAULT");
				_isdefault = value;
			}
		}

		public IEnumerable<HOGIADINH_DIACHI> REF_HOGIADINH_DIACHI
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _ref_hogiadinh_diachi == null))
					InfoTech.Core.Data.Receiver.TypeObject<HOGIADINH_DIACHI>.Select(this, "REF_HOGIADINH_DIACHI", new[] { new Vector<string, string>("MAGIAOXU", "MAGIAOXU"), }, InfoTech.Core.Data.RelationType.OnetoMany);
				return _ref_hogiadinh_diachi;
			}
			set
			{
				_ref_hogiadinh_diachi = value;
			}
		}

		public IEnumerable<SOHONNHAN> REF_SOHONNHAN
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _ref_sohonnhan == null))
					InfoTech.Core.Data.Receiver.TypeObject<SOHONNHAN>.Select(this, "REF_SOHONNHAN", new[] { new Vector<string, string>("MAGIAOXU", "MAGIAOXU"), }, InfoTech.Core.Data.RelationType.OnetoMany);
				return _ref_sohonnhan;
			}
			set
			{
				_ref_sohonnhan = value;
			}
		}

		public IEnumerable<GIAODAN> REF_GIAODAN
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _ref_giaodan == null))
					InfoTech.Core.Data.Receiver.TypeObject<GIAODAN>.Select(this, "REF_GIAODAN", new[] { new Vector<string, string>("MAGIAOXU", "MAGIAOXU"), }, InfoTech.Core.Data.RelationType.OnetoMany);
				return _ref_giaodan;
			}
			set
			{
				_ref_giaodan = value;
			}
		}

		public IEnumerable<GIAODAN_DIACHI> REF_GIAODAN_DIACHI
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _ref_giaodan_diachi == null))
					InfoTech.Core.Data.Receiver.TypeObject<GIAODAN_DIACHI>.Select(this, "REF_GIAODAN_DIACHI", new[] { new Vector<string, string>("MAGIAOXU", "MAGIAOXU"), }, InfoTech.Core.Data.RelationType.OnetoMany);
				return _ref_giaodan_diachi;
			}
			set
			{
				_ref_giaodan_diachi = value;
			}
		}

		public IEnumerable<GIAOHO> REF_GIAOHO
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _ref_giaoho == null))
					InfoTech.Core.Data.Receiver.TypeObject<GIAOHO>.Select(this, "REF_GIAOHO", new[] { new Vector<string, string>("MAGIAOXU", "MAGIAOXU"), }, InfoTech.Core.Data.RelationType.OnetoMany);
				return _ref_giaoho;
			}
			set
			{
				_ref_giaoho = value;
			}
		}

		public IEnumerable<HOGIADINH> REF_HOGIADINH
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _ref_hogiadinh == null))
					InfoTech.Core.Data.Receiver.TypeObject<HOGIADINH>.Select(this, "REF_HOGIADINH", new[] { new Vector<string, string>("MAGIAOXU", "MAGIAOXU"), }, InfoTech.Core.Data.RelationType.OnetoMany);
				return _ref_hogiadinh;
			}
			set
			{
				_ref_hogiadinh = value;
			}
		}

		public LINHMUC PRT_LINHMUC
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _prt_linhmuc == default(LINHMUC)))
					InfoTech.Core.Data.Receiver.TypeObject<LINHMUC>.Select(this, "PRT_LINHMUC", new[] { new Vector<string, string>("MACHAXU", "MACHAXU"), }, InfoTech.Core.Data.RelationType.OnetoOne);
				return _prt_linhmuc;
			}
			set
			{
				_prt_linhmuc = value;
			}
		}

		public GIAOHAT PRT_GIAOHAT
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _prt_giaohat == default(GIAOHAT)))
					InfoTech.Core.Data.Receiver.TypeObject<GIAOHAT>.Select(this, "PRT_GIAOHAT", new[] { new Vector<string, string>("MAGIAOHAT", "MAGIAOHAT"), }, InfoTech.Core.Data.RelationType.OnetoOne);
				return _prt_giaohat;
			}
			set
			{
				_prt_giaohat = value;
			}
		}

		#endregion

		#region Reflector

		public System.Type Reflector()
		{
			return typeof(GIAOXU);
		}
		public object Current
		{
			get { return this; }
		}

		#endregion

	}
}
